/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jp.selfportrait.twonkyscrobbler4j.example;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.roarsoftware.lastfm.scrobble.ResponseStatus;
import net.roarsoftware.lastfm.scrobble.Scrobbler;
import net.roarsoftware.lastfm.scrobble.Source;

/**
 *
 * @author kazuho
 */
public class ScrobbleExample {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            Scrobbler scrobbler = Scrobbler.newScrobbler("tst", "1.0", "TwonkyScrobbler");
            ResponseStatus status = scrobbler.handshake("test");
            System.out.println("handshake ok: " + status.ok());
            status = scrobbler.nowPlaying("Pixies", "Where Is My Mind?");
            System.out.println("now playing ok: " + status.ok());
            status = scrobbler.submit("Pixies", "Where Is My Mind?", "Surfer Rosa", 233, 7, Source.USER, (System.currentTimeMillis() / 1000) - 117); // see javadoc for parameter explanation
            System.out.println("submission: " + status.ok());
        } catch (IOException ex) {
            Logger.getLogger(ScrobbleExample.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}
